package spaces;

import vectors.Vector;

public class ChargeableNode extends Node {

	protected Vector charge;
	
	public ChargeableNode(String name) {
		super(name);
	}

	public ChargeableNode(String name, Vector pos) {
		super(name, pos);
		charge = Vector.zero(pos.getNOD());
	}
	
	public void setPos(Vector pos){
		super.setPos(pos);
		if(charge == null){
			charge = Vector.zero(pos.getNOD());
		}
	}
	
	public void addCharge(Vector ch){
		charge = charge.plus(ch);
	}
	
	public void applyCharge(){
		pos = pos.plus(charge);
		charge = Vector.zero(charge.getNOD());
	}

}
